package com.dtz.rabbitmq.direct.service;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

import com.dtz.rabbitmq.constant.RabbitConstant;

import lombok.extern.slf4j.Slf4j;


/**
 * 可以在消费端通过如下注解进行声名交换机及队列，并绑定关系
 * @author 陶志胜
 *
 */
@Slf4j
@Service
@RabbitListener(bindings = @QueueBinding(
	value = @Queue(name = RabbitConstant.DIRECT_DUANXIN_QUEUE, durable = "true"),
	exchange = @Exchange(name = RabbitConstant.DIRECT_ORDER_EXCHANGE, type = ExchangeTypes.DIRECT, durable = "true"),
	key = RabbitConstant.DUANXIN_ROUTING_KEY
))
public class DirectDuanxinService {

	@RabbitHandler
	public void message(String message) {
		log.info("duanxin --------->{}", message);
	}
	
}
